#include<stdio.h>
int countdigit(int number,int digit);
int main (void)
{
	int number,digit,n;
//	printf("%d",countdigit (12345,2));
	while(scanf("%d",&number)!=EOF)
	{
		digit=2;
		n=countdigit(number,digit);
//		digit=2;
		printf("%d\n",n);
//		return 0;
	}
	return 0;
}
int countdigit (int number,int digit)
{
	int count=0,n=0;
	int j;
	int temp=number;
	while(number!=0)
	{
		number=number/10;
		count++;
	}
	for(j=1;j<=count;j++)
	{
		if(temp%10==digit)
			n++	;
		temp=temp/10;
	}
	return n;
//	return count;
}

